package com.dongdongshop.util;

import java.io.Serializable;
import java.util.List;

/**
 * @Auther: WX
 * @Date: 2021/3/17 17:01
 * @Description:
 */
//用于接收分页信息
public class PageBean<T> implements Serializable {
    private Integer pageNum;// 当前页数
    private Integer pageSize;// 每页条数
    private Integer pages;//总页数
    private Long total;//总条数
    private List<T> list;//查询出的数据

    public Integer getPageNum() {
        return pageNum;
    }

    public void setPageNum(Integer pageNum) {
        this.pageNum = pageNum;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public Integer getPages() {
        return pages;
    }

    public void setPages(Integer pages) {
        this.pages = pages;
    }

    public Long getTotal() {
        return total;
    }

    public void setTotal(Long total) {
        this.total = total;
    }

    public List<T> getList() {
        return list;
    }

    public void setList(List<T> list) {
        this.list = list;
    }

    public PageBean(Integer pageNum, Integer pageSize, Integer pages, Long total, List<T> list) {
        this.pageNum = pageNum;
        this.pageSize = pageSize;
        this.pages = pages;
        this.total = total;
        this.list = list;
    }

    public PageBean() {
    }

    public static PageBean<Object> buildPageBean(Integer pageNum, Integer pageSize, Integer pages, Long total, List<Object> list){
        PageBean<Object> pageBean = new PageBean();
        pageBean.setPageNum(pageNum);
        pageBean.setPageSize(pageSize);
        pageBean.setPages(pages);
        pageBean.setTotal(total);
        pageBean.setList(list);
        return pageBean;
    }
}
